//
//  NSString+Safe.h
//  lc-collect
//
//  Created by mac on 2021/3/3.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

/// 避免null
@interface NSString (Safe)

/// 避免Format所得的字符串带有null
+ (instancetype)noNULLStringWithFormat:(NSString *)format, ... NS_FORMAT_FUNCTION(1,2);

- (NSString *)safeSubstringFromIndex:(NSUInteger)from;

- (NSString *)safeSubstringToIndex:(NSUInteger)to;

- (NSString *)safeSubstringWithRange:(NSRange)range;

- (NSRange)safeRangeOfString:(NSString *)aString;

- (NSRange)safeRangeOfString:(NSString *)aString
                     options:(NSStringCompareOptions)mask;

- (NSString *)safeStringByAppendingString:(NSString *)aString;

- (NSString *)safeStringByReplacingCharactersInRange:(NSRange)aRange
                                          withString:(NSString *)aString;

@end

NS_ASSUME_NONNULL_END
